#include "main.h"

#pragma code-name (push, "LOWPRG")

void fmtscore(const u16 num) {
	utoa4(scorebuf, num);
	scorebuf[4] = '0';
	scorebuf[5] = '0';
	scorebuf[6] = '\0';
}

void utoa4(char * const buf, u16 num) {

	// snprintf %04u

	u8 tmp;

	tmp = num % 10;
	num /= 10;

	buf[3] = '0' + tmp;

	tmp = num % 10;
	num /= 10;

	buf[2] = '0' + tmp;

	tmp = num % 10;
	num /= 10;

	buf[1] = '0' + tmp;

	tmp = num % 10;
	num /= 10;

	buf[0] = '0' + tmp;

	buf[4] = '\0';
}

#pragma code-name (pop)
